#include <render.h>

extern T_PicFileParser g_tBMPParser;
#if 0
int GetFontPixel()
{
}

int GetPicPixel()
{
}

int DrawPixel()
{
}
#endif
void FlushVideoMemToDev(PT_VideoMem ptVideoMem)
{
	if(!ptVideoMem->bDevFrameBuffer)
	{
	//memcpy(GetDefaultDispDev()->pucDispMem ,ptVideoMem->tPixelDatas.aucPixelDatas,ptVideoMem.tPixelDatas.iHeight * ptVideoMem.tPixelDatas.iLineBytes);
		GetDefaultDispDev()->ShowPage(ptVideoMem);
	}
}
void FreePixelDatasForIcon(PT_PixelDatas ptPixelDatas)
{
	g_tBMPParser.FreePixelDatas(ptPixelDatas);
}

int GetPixelDatasForIcon(char * strFileName,PT_PixelDatas ptPixelDatas)
{
	T_FileMap tFileMap;
	int iError; 
	int iBpp=0,iXres=0,iYres=0;
	snprintf(tFileMap.strFileName,128,"%s/%s",ICON_PATH,strFileName);
	tFileMap.strFileName[127] = '\0';
	
	iError = MapFile(&tFileMap);
	if(iError)
	{
		DBG_PRINT("MapFile %s error\n",strFileName);
		return -1;
	}
	iError = g_tBMPParser.isSupport(tFileMap.pucFileMapMem);
	if(iError == 0)
	{
		DebugPrint("can`t support %s\n",strFileName);
		return -1;
	}
	
	GetDispResolution(&iXres,&iYres, &iBpp);
	
	ptPixelDatas->iBpp = iBpp;
	iError = g_tBMPParser.GetPixelDatas(tFileMap.pucFileMapMem,ptPixelDatas);
	if(iError)
	{
		DBG_PRINT("GetPixelDatas error for %s\n",strFileName);
		return -1;
	}
	return 0;
}

